package com.ruoyi.merchant.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 聊天记录对象 chat_records
 */
public class ChatRecord extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 聊天记录ID */
    private Long chatId;

    /** 会话ID */
    @Excel(name = "会话ID")
    private Long sessionId;

    /** 对话类型：1-用户与平台客服，2-用户与商家，3-系统通知 */
    @Excel(name = "对话类型：1-用户与平台客服，2-用户与商家，3-系统通知")
    @NotNull(message = "对话类型不能为空")
    private Integer chatType;

    /** 用户ID */
    @Excel(name = "用户ID")
    @NotNull(message = "用户ID不能为空")
    private Long customerId;

    /** 平台客服ID */
    @Excel(name = "平台客服ID")
    private Long staffId;

    /** 商家ID */
    @Excel(name = "商家ID")
    private Long merchantId;

    /** 发送者类型：1-用户，2-平台客服，3-商家，4-系统 */
    @Excel(name = "发送者类型：1-用户，2-平台客服，3-商家，4-系统")
    @NotNull(message = "发送者类型不能为空")
    private Integer senderType;

    /** 发送者ID */
    @Excel(name = "发送者ID")
    private Long senderId;

    /** 消息内容 */
    @Excel(name = "消息内容")
    @NotNull(message = "消息内容不能为空")
    private String content;

    /** 附件信息（JSON字符串） */
    private String attachments;

    /** 消息类型：1-文本，2-图片，3-文件，4-语音，5-系统通知 */
    @Excel(name = "消息类型：1-文本，2-图片，3-文件，4-语音，5-系统通知")
    private Integer messageType;

    /** 是否已读：0-未读，1-已读 */
    @Excel(name = "是否已读：0-未读，1-已读")
    private Integer isRead;

    /** 服务评分：1-5分 */
    @Excel(name = "服务评分：1-5分")
    private Integer serviceRating;

    /** 关联订单ID */
    @Excel(name = "关联订单ID")
    private Long relatedOrderId;

    /** 发送时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date sentAt;

    /** 阅读时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "阅读时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date readAt;

    // getter/setter 方法
    public void setChatId(Long chatId) {
        this.chatId = chatId;
    }

    public Long getChatId() {
        return chatId;
    }

    public void setSessionId(Long sessionId) {
        this.sessionId = sessionId;
    }

    public Long getSessionId() {
        return sessionId;
    }

    public void setChatType(Integer chatType) {
        this.chatType = chatType;
    }

    public Integer getChatType() {
        return chatType;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setStaffId(Long staffId) {
        this.staffId = staffId;
    }

    public Long getStaffId() {
        return staffId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setSenderType(Integer senderType) {
        this.senderType = senderType;
    }

    public Integer getSenderType() {
        return senderType;
    }

    public void setSenderId(Long senderId) {
        this.senderId = senderId;
    }

    public Long getSenderId() {
        return senderId;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setAttachments(String attachments) {
        this.attachments = attachments;
    }

    public String getAttachments() {
        return attachments;
    }

    public void setMessageType(Integer messageType) {
        this.messageType = messageType;
    }

    public Integer getMessageType() {
        return messageType;
    }

    public void setIsRead(Integer isRead) {
        this.isRead = isRead;
    }

    public Integer getIsRead() {
        return isRead;
    }

    public void setServiceRating(Integer serviceRating) {
        this.serviceRating = serviceRating;
    }

    public Integer getServiceRating() {
        return serviceRating;
    }

    public void setRelatedOrderId(Long relatedOrderId) {
        this.relatedOrderId = relatedOrderId;
    }

    public Long getRelatedOrderId() {
        return relatedOrderId;
    }

    public void setSentAt(Date sentAt) {
        this.sentAt = sentAt;
    }

    public Date getSentAt() {
        return sentAt;
    }

    public void setReadAt(Date readAt) {
        this.readAt = readAt;
    }

    public Date getReadAt() {
        return readAt;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("chatId", getChatId())
                .append("sessionId", getSessionId())
                .append("chatType", getChatType())
                .append("customerId", getCustomerId())
                .append("staffId", getStaffId())
                .append("merchantId", getMerchantId())
                .append("senderType", getSenderType())
                .append("senderId", getSenderId())
                .append("content", getContent())
                .append("attachments", getAttachments())
                .append("messageType", getMessageType())
                .append("isRead", getIsRead())
                .append("serviceRating", getServiceRating())
                .append("relatedOrderId", getRelatedOrderId())
                .append("sentAt", getSentAt())
                .append("readAt", getReadAt())
                .append("createdAt", getCreateTime())
                .append("updatedAt", getUpdateTime())
                .toString();
    }
}